import ResponseData from '@/common/ResponseData'
import {RequestMethod,Controller,RequestMapping } from "./../common/decorator/index"
import FoodList from './../../mock/food.json'

@Controller("/api/food")
class TestController {

    @RequestMapping({ 
        url:"/getFoodList",
        method: RequestMethod.All, 
    })
    async test(ctx){
        const startIndex = parseInt(Math.random() * 100);
        const endIndex = startIndex + 20;
        const list = [];
        for(let index = startIndex; index<endIndex; index++){
            list.push(FoodList[index])
        }
        ctx.body = ResponseData.success(list);
    }
}

export default TestController;